Linkedin Java 技術認證題庫


Posted by c9103205 on 2021-07-05

Which statements about abstract classes are true?

1. They can be instantiated.
2. They allow member variables and methods to be inherited by subclasses.
3. They can contain constructors.
  1. 1, 2, and 3
  2. only 3
  3. 2 and 3
  4. only 2

answer: 3
抽象類別的參數可以被子類別繼承,並可以包含建構子,但無法被實例化

Why are ArrayLists better than arrays?

  1. You don't have to decide the size of an ArrayList when you first make it.
  2. You can put more items into an ArrayList than into an array.
  3. ArrayLists can hold more kinds of objects than arrays.
  4. You don't have to decide the type of an ArrayList when you first make it.

answer : 1
出這題的人應該怨念很深,只要被array雷過的應該都有感覺,Java中的array必須宣告大小,這也是筆者認為array不好用的地方,一不小心就會 ArrayIndexOutOfBounds
其餘三點,array也能放入物件
ex:
Integer[] arraySimple = new Integer[10];


#linkedin #java







Related Posts

12. Flyweight

12. Flyweight

Day5 跟一般的指令可不一樣啊!跟我所認識的指令不同啊!

Day5 跟一般的指令可不一樣啊!跟我所認識的指令不同啊!

各種在瀏覽器上發送 request 的方法

各種在瀏覽器上發送 request 的方法


Comments